# -*- coding: utf-8 -*-

import os
import numpy as np
import cv2


def main():
    folder = "/home/lijun/Dataset/vehicle_segment/origin"
    images_path = [os.path.join(folder, name) for name in os.listdir(folder)
                   if "jpg" in name and "mask" not in name]
    sum_image = np.zeros(shape=(180, 320, 3), dtype=np.float32)
    for image_path in images_path:
        image = cv2.imread(image_path)
        sum_image += image
    sum_image = np.rollaxis(sum_image, 2)
    print(sum_image.shape)
    s = np.sum(sum_image, axis=2)
    s = np.sum(s, axis=1)
    print(s / len(images_path) / (180*320))  # (104, 110, 109)


if __name__ == "__main__":
    main()
